<template>
	<section class="aui-flexView">

		<section class="aui-scrollView">
			<div class="aui-tab" data-ydui-tab>
				<ul class="tab-nav">
					<block v-for="(menuTab,index) in menuTabs" :key="index">
						<li v-bind:id="'tabNum'+index" @click="swichMenu(index)"
							:class="[currentTab==index ? 'tab-nav-item tab-active' : 'tab-nav-item']">
							{{menuTab.name}}
						</li>
					</block>
				</ul>
				<div class="divHeight"></div>
				<div class="tab-panel">
					<block v-for="(menuList,index2) in menuLists" :key="index2">
						<div :class="[currentTab==index2 ? 'tab-panel-item tab-active' : 'tab-panel-item']">
							<block v-for="(menuList2,index3) in menuList" :key="index3">
								<div class="tab-item">
									<a href="javascript:void(0);" class="aui-well-item aui-well-item-clear">
										<div class="aui-well-item-hd">
											<img :src="menuList2.logoimg" alt="">
										</div>
										<div class="aui-well-item-bd">
											<h3>{{menuList2.dname}}</h3>
										</div>
										<span class="aui-well-item-fr">{{menuList2.zt}}</span>
									</a>
									<div class="aui-mail-product">
										<a href="javascript:;" class="aui-mail-product-item">
											<div class="aui-mail-product-item-hd">
												<img :src="menuList2.img" alt="">
											</div>
											<div class="aui-mail-product-item-bd">
												<p>{{menuList2.name}}</p>
											</div>
										</a>
									</div>
									<view class="number-box">
										<p class="order-number">订单编号：{{menuList2.number}}</p>
									</view>
									<a href="javascript:;" class="aui-mail-payment">

										<p>
											共{{menuList2.sum}}件商品 实付款: ￥{{menuList2.pri}}
										</p>
									</a>
									<div class="aui-mail-button">
										<a href="javascript:;"
											:class="[menuList2.but_ddshouhuo==0 ? 'hd' : menuList2.but_ddshouhuo==2 ? '' :'aui-df-color']">等待收货</a>
										<a href="javascript:;"
											:class="[menuList2.but_wuliu==0 ? 'hd' : menuList2.but_wuliu==2 ? '' :'aui-df-color']">查看物流</a>
										<a href="javascript:;"
											:class="[menuList2.but_rebuy==0 ? 'hd' : menuList2.but_rebuy==2 ? '' :'aui-df-color']" @click="goTodetails(menuList2)">再次购买</a>
										<a href="javascript:;"
											:class="[menuList2.but_pingjia==0 ? 'hd' : menuList2.but_pingjia==2 ? '' :'aui-df-color']">评价晒单</a>
										<a href="javascript:;"
											:class="[menuList2.but_fapiao==0 ? 'hd' : menuList2.but_fapiao==2 ? '' :'aui-df-color']">查看发票</a>
										<view class="">
											<a href="javascript:;"
												:class="[menuList2.but_zhifu==0 ? 'hd' : menuList2.but_zhifu==2 ? '' :'aui-df-color']"
												@click="goTodetails(menuList2)">立即支付</a>
										</view>
									</div>
								</div>
								<div :class="[index3+1==menuList.length ? 'hd':'divHeight']"></div>
							</block>
						</div>
					</block>
				</div>
			</div>
		</section>
	</section>

</template>

<script>
	export default {
		data() {
			return {
				scrollLeft: 0,
				isClickChange: false,
				currentTab: 0,
				menuTabs: [{
					name: '全部'
				}, {
					name: '待付款'
				}, {
					name: '待收货'
				}, {
					name: '已完成'
				}, {
					name: '待评价'
				}, ],
				menuLists: [
					[{
							"logoimg": '../../static/icon-logo.png',
							"dname": "自营FILA产品专营店",
							"zt": "等待收货",
							"img": '../../static/pd-003.png',
							"name": "FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41",
							"sum": "1",
							"pri": "5899.00",
							"but_ddshouhuo": 2,
							"but_rebuy": 1,
							"but_pingjia": 0,
							"but_fapiao": 0,
							"but_zhifu": 0,
							"but_wuliu": 1,
							"number": 7694547312168,
						}, {
							"logoimg": '../../static/icon-logo.png',
							"dname": "自营零食产品专营店",
							"zt": "已完成",
							"img": '../../static/pd-004.png',
							"name": "盼盼 酸梅汤 酸梅汁风味饮料 250ml*24盒 整箱 果汁饮料",
							"sum": "1",
							"pri": "21.00",
							"but_rebuy": 2,
							"but_pingjia": 1,
							"but_fapiao": 1,
							"but_zhifu": 0,
							"but_wuliu": 0,
							"but_ddshouhuo": 0,
							"number": 4246814524653,
						}, {
							"logoimg": '../../static/icon-logo.png',
							"dname": "自营Apple产品专营店",
							"zt": "已取消",
							"img": '../../static/pd-001.png',
							"name": "Apple 苹果 iPhone8 Plus 4G手机 深空灰 移动联通版64G裸机Apple 苹果 iPhone8 Plus 4G手机 深空灰 移动联通版64G裸机",
							"sum": "1",
							"pri": "6899.00",
							// 0=没有,1=有,2=标红
							"but_rebuy": 2,
							"but_pingjia": 1,
							"but_fapiao": 1,
							"but_zhifu": 0,
							"but_wuliu": 0,
							"but_ddshouhuo": 0,
							"number": 4246934648731,
						},
						{
							"logoimg": '../../static/icon-logo.png',
							"dname": "SONY京东自营官方旗舰店",
							"zt": "已取消",
							"img": '../../static/pd-002.png',
							"name": "索尼（SONY）WH-1000XM2 Hi-Res无线蓝牙耳机 智能降噪耳机 头戴式 1000x二代 香槟金",
							"sum": "1",
							"pri": "3899.00",
							"but_rebuy": 2,
							"but_pingjia": 0,
							"but_fapiao": 0,
							"but_zhifu": 0,
							"but_wuliu": 0,
							"but_ddshouhuo": 0,
							"number": 424878652741,
						},
						{
							"logoimg": '../../static/icon-logo.png',
							"dname": "自营FILA产品专营店",
							"zt": "已取消",
							"img": '../../static/pd-003.png',
							"name": "FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41",
							"sum": "1",
							"pri": "4899.00",
							"but_rebuy": 2,
							"but_pingjia": 1,
							"but_fapiao": 0,
							"but_zhifu": 0,
							"but_wuliu": 0,
							"but_ddshouhuo": 0,
							"number": 4246934648731,
						},
					],
					[{
						"logoimg": '../../static/icon-logo.png',
						"dname": "SONY京东自营官方旗舰店",
						"zt": "等待付款",
						"img": '../../static/pd-002.png',
						"name": "索尼（SONY）WH-1000XM2 Hi-Res无线蓝牙耳机 智能降噪耳机 头戴式 1000x二代 香槟金",
						"sum": "1",
						"pri": "2899.00",
						"but_rebuy": 0,
						"but_pingjia": 0,
						"but_fapiao": 0,
						"but_zhifu": 2,
						"but_wuliu": 0,
						"but_ddshouhuo": 0,
						"number": 4244464634648,
					}],
					[{
						"logoimg": '../../static/icon-logo.png',
						"dname": "自营FILA产品专营店",
						"zt": "等待收货",
						"img": '../../static/pd-003.png',
						"name": "FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41FILA斐乐男鞋2018夏季新款LOGO轻便复古跑鞋运动鞋男 标准白 41",
						"sum": "1",
						"pri": "5899.00",
						"but_ddshouhuo": 2,
						"but_rebuy": 1,
						"but_pingjia": 0,
						"but_fapiao": 0,
						"but_zhifu": 0,
						"but_wuliu": 1,
						"number": 7694547312168,
					}],
					[{
						"logoimg": '../../static/icon-logo.png',
						"dname": "自营零食产品专营店",
						"zt": "已完成",
						"img": '../../static/pd-004.png',
						"name": "盼盼 酸梅汤 酸梅汁风味饮料 250ml*24盒 整箱 果汁饮料",
						"sum": "1",
						"pri": "21.00",
						"but_rebuy": 2,
						"but_pingjia": 1,
						"but_fapiao": 1,
						"but_zhifu": 0,
						"but_wuliu": 0,
						"but_ddshouhuo": 0,
						"number": 4246814524653,
					}],
					[{
						"logoimg": '../../static/icon-logo.png',
						"dname": "自营OPPO产品专营店",
						"zt": "待评价",
						"img": '../../static/pd-005.png',
						"name": "OPPO R15 全面屏双摄拍照手机 4G+128G 雪盈白 全网通 移动联通电信4G 双卡双待手机",
						"sum": "1",
						"pri": "21.00",
						"but_rebuy": 2,
						"but_pingjia": 1,
						"but_fapiao": 1,
						"but_zhifu": 0,
						"but_wuliu": 0,
						"but_ddshouhuo": 0,
						"number": 4243472487561,
					}],
				]
			}
		},
		onLoad() {
			// for (var i = 0; i < this.menuLists.length; i++) {
			// 	this.getDateList(i);
			// }
		},
		methods: {
			goTodetails() {
				uni.navigateTo({
					url: '/pages/tabBar/pay/pay'
				});
			},
			swichMenu: async function(current) { //点击其中一个选项
				if (this.currentTab == current) {
					return false;
				} else {
					this.currentTab = current;
					this.setScrollLeft(current);
				}
			},
			swiperChange: async function(e) {
				let index = e.target.current;
				this.setScrollLeft(index);
				this.currentTab = index;
			},
			setScrollLeft: async function(tabIndex) {
				let leftWidthSum = 0;
				for (var i = 0; i <= tabIndex; i++) {
					let nowElement = await this.getWidth('tabNum' + i);
					leftWidthSum = leftWidthSum + nowElement.width;
				}
				let winWidth = uni.getSystemInfoSync().windowWidth;
				this.scrollLeft = leftWidthSum > winWidth ? (leftWidthSum - winWidth) : 0
			},
			getWidth: function(id) { //得到元素的宽高
				return new Promise((res, rej) => {
					uni.createSelectorQuery().select("#" + id).fields({
						size: true,
						scrollOffset: true
					}, (data) => {
						res(data);
					}).exec();
				})
			},
			getDateList: function(tabIndex) {
				// var entity = this.menuTabs[tabIndex].name;
				// this.menuLists[tabIndex].push(entity);
			}
		}
	}
</script>

<style>
	/* 公共样式表css */
	html,
	body {
		color: #333;
		margin: 0;
		height: 100%;
		font-family: "Myriad Set Pro", "Helvetica Neue", Helvetica, Arial, Verdana, sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		font-weight: normal;
	}

	* {
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
	}

	a {
		text-decoration: none;
		color: #000;
	}

	a,
	label,
	button,
	input,
	select {
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
	}

	img {
		border: 0;
	}

	body {

		background: #fff;
		color: #666;
	}

	html,
	body,
	div,
	dl,
	dt,
	dd,
	ol,
	ul,
	li,
	h1,
	h2,
	h3,
	h4,
	h5,
	h6,
	p,
	blockquote,
	pre,
	button,
	fieldset,
	form,
	input,
	legend,
	textarea,
	th,
	td {
		margin: 0;
		padding: 0;
	}

	a {
		text-decoration: none;
		color: #08acee;
	}

	button {
		outline: 0;
	}

	img {
		border: 0;
	}

	button,
	input,
	optgroup,
	select,
	textarea {
		margin: 0;
		font: inherit;
		color: inherit;
		outline: none;
	}

	li {
		list-style: none;
	}

	a {
		color: #666;
	}

	.clearfix::after {
		clear: both;
		content: ".";
		display: block;
		height: 0;
		visibility: hidden;
	}

	.clearfix {}

	/* 必要布局样式css */
	.aui-flexView {
		width: 100%;
		height: 100%;
		margin: 0 auto;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		-webkit-flex-direction: column;
		-ms-flex-direction: column;
		flex-direction: column;
	}

	.aui-scrollView {
		width: 100%;
		height: 100%;
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		-ms-flex: 1;
		flex: 1;
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
		position: relative;
		/* margin-top: -44px; */
	}

	.aui-navBar {
		height: 44px;
		position: relative;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		z-index: 1002;
		background: #ffffff;
	}

	.aui-navBar:after {
		content: '';
		position: absolute;
		z-index: 2;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 1px;
		border-bottom: 1px solid #ffffff;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		-webkit-transform-origin: 0 100%;
		transform-origin: 0 100%;
	}

	.aui-navBar-item {
		height: 44px;
		min-width: 25%;
		-webkit-box-flex: 0;
		-webkit-flex: 0 0 25%;
		-ms-flex: 0 0 25%;
		flex: 0 0 25%;
		padding: 0 0.9rem;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-ms-flex-align: center;
		align-items: center;
		font-size: 0.7rem;
		white-space: nowrap;
		overflow: hidden;
		color: #a0a0a0;
		position: relative;
	}

	.aui-navBar-item:first-child {
		-webkit-box-ordinal-group: 2;
		-webkit-order: 1;
		-ms-flex-order: 1;
		order: 1;
		margin-right: -25%;
		font-size: 0.9rem;
		font-weight: bold;
	}

	.aui-navBar-item:last-child {
		-webkit-box-ordinal-group: 4;
		-webkit-order: 3;
		-ms-flex-order: 3;
		order: 3;
		-webkit-box-pack: end;
		-webkit-justify-content: flex-end;
		-ms-flex-pack: end;
		justify-content: flex-end;
	}

	.aui-center {
		-webkit-box-ordinal-group: 3;
		-webkit-order: 2;
		-ms-flex-order: 2;
		order: 2;
		display: -webkit-box;
		display: -webkit-flex;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-pack: center;
		-webkit-justify-content: center;
		-ms-flex-pack: center;
		justify-content: center;
		-webkit-box-align: center;
		-webkit-align-items: center;
		-ms-flex-align: center;
		align-items: center;
		height: 44px;
		width: 50%;
		margin-left: 25%;
	}

	.aui-center-title {
		text-align: center;
		width: 100%;
		white-space: nowrap;
		overflow: hidden;
		display: block;
		text-overflow: ellipsis;
		font-size: 0.95rem;
		color: #3c3c3c;
	}

	.icon {
		width: 20px;
		height: 20px;
		display: block;
		border: none;
		float: left;
		background-size: 20px;
		background-repeat: no-repeat;
	}

	.icon-return {
		background-image: url("");
	}

	.icon-sys {
		background-image: url("");
	}

	.tab-nav {
		background: #FFFFFF;
		height: 40px;
		line-height: 40px;
		/* border-radius: 80px; */
		display: block;
		/* margin: 0 auto; */
		position: fixed;
		width: 100%;
		margin-bottom: 15%;
		/* width: 185px; */
		z-index: 9999;
	}

	.tab-nav:after {
		content: '';
		position: fixed;
		z-index: 2;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 1px;
		border-bottom: 1px solid #bbbbbb;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		-webkit-transform-origin: 0 100%;
		transform-origin: 0 100%;
	}

	.tab-nav-item {
		height: 40px;
		line-height: 40px;
		position: relative;
		text-align: center;
		color: #585858;
		font-size: 0.9rem;
		display: block;
		float: left;
		border-radius: 80px;
		/* padding: 0 15px; */
		width: 20%;
		margin: 0 auto;
	}

	.tab-nav-item.tab-active {
		/* background-color: #51bd03; */
	}

	.tab-nav-item.tab-active a {
		color: #000000;
		font-weight: bold;
	}

	.tab-nav-item a {
		display: inherit;
		color: inherit;
		font-size: 0.8rem;
		color: #464646;
	}

	.tab-panel {
		position: relative;
		overflow: hidden;
	}

	.tab-panel .tab-panel-item {
		width: 100%;
		position: absolute;
		top: 0;
		-webkit-transform: translateX(-100%);
		transform: translateX(-100%);
	}

	.tab-nav-item.tab-active:before {
		content: '';
		width: 40%;
		height: 0px;
		position: absolute;
		left: 50%;
		bottom: 0;
		margin-left: -20%;
		z-index: 4;
		background-color: #f23030;
		border-radius: 120px;
		border: 1px solid #f23030;
	}

	.tab-panel .tab-panel-item.tab-active~.tab-panel-item {
		-webkit-transform: translateX(100%);
		transform: translateX(100%);
	}

	.tab-panel .tab-panel-item.tab-active {
		position: relative;
		-webkit-transition: -webkit-transform .15s;
		transition: -webkit-transform .15s;
		transition: transform .15s;
		transition: transform .15s, -webkit-transform .15s;
		-webkit-transform: translateX(0);
		transform: translateX(0);
	}

	.divHeight {
		background: #f0f2f5;
		width: 100%;
		height: 10px;
		padding-top: 20px;
	}

	.aui-well-item {
		padding: 20px 15px 20px 20px;
		position: relative;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
	}

	.aui-well-item-hd {
		margin-right: .4em;
		width: 19px;
		height: 19px;
		line-height: 19px;
		text-align: center;
	}

	.aui-well-item-hd img {
		width: 100%;
		max-height: 100%;
		vertical-align: top;
		display: block;
		border: none;
		margin-top: 3px;
	}

	.aui-well-item-bd {
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		min-width: 0;
	}

	.aui-well-item-bd h3 {
		color: #333;
		font-size: 0.9rem;
		position: relative;
		/* padding-left: 20px; */
		font-weight: normal;
		padding-bottom: 0;
		text-align: left;
	}

	.aui-well-item-fr {
		font-size: 0.85rem;
		text-align: right;
		color: #999999;
		padding-right: 25px;
		position: relative;
	}

	.aui-well-item-fr:after {
		content: " ";
		display: inline-block;
		height: 18px;
		width: 18px;
		background-image: url("");
		background-size: 18px;
		top: -2px;
		position: absolute;
		top: 50%;
		margin-top: -9px;
		right: 0px;
		border-radius: 2px;
	}

	.aui-mail-product {
		background: #f7f7f7;
		padding: 20px;
		position: relative;
		overflow: hidden;
	}

	.aui-mail-product-item {
		/* padding: 15px; */
		position: relative;
		display: -webkit-box;
		display: -webkit-flex;
		display: flex;
		-webkit-box-align: center;
		-webkit-align-items: center;
		align-items: center;
	}

	.aui-mail-product-item-hd {
		margin-right: .8em;
		width: 70px;
		height: 70px;
		line-height: 70px;
		text-align: center;
	}

	.aui-mail-product-item-hd img {
		width: 100%;
		max-height: 100%;
		vertical-align: top;
	}

	.aui-mail-product-item-bd {
		-webkit-box-flex: 1;
		-webkit-flex: 1;
		flex: 1;
		min-width: 0;
	}

	.aui-mail-product-item-bd p {
		color: #404040;
		font-size: 13px;
		line-height: 1.4;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
	}

	.aui-mail-payment {
		padding: 10px 15px;
		position: relative;
		text-align: right;
		font-size: 0.8rem;
		color: #333;
		overflow: hidden;
		display: block;
	}

	.aui-mail-payment p em {
		font-style: normal;
	}

	.aui-mail-payment p i {
		font-size: 1.3rem;
		font-style: normal;
	}

	.aui-mail-payment:after {
		content: '';
		position: absolute;
		z-index: 2;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 1px;
		border-bottom: 1px solid #e2e2e2;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		-webkit-transform-origin: 0 100%;
		transform-origin: 0 100%;
	}

	.aui-mail-button {
		padding: 15px 20px 15px 0;
		overflow: hidden;
	}

	.aui-mail-button a {
		background: none;
		border: 1px solid #f0250f;
		color: #f0250f;
		font-size: 0.8rem;
		border-radius: 40px;
		/* display: block; */
		padding: 2px 14px;
		/* display: inline-block; */
		float: right;
		margin-left: 8px;
	}

	.aui-mail-button .aui-df-color {
		color: #333;
		border: 1px solid #ddd;
	}

	.aui-well-wait {
		text-align: right;
		color: #f0250f;
		font-size: 0.8rem;
	}

	.hd {
		display: none;
	}

	.number-box {

		width: 90%;
		font-size: 15rpx;
		padding: 20rpx;
		margin-left: 35rpx;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
		border-bottom: #d3d3d3 1px solid;


		.order-number {
			color: #a8a8a8;
			position: absolute;
			left: 0;

		}
	}
</style>
